<body>
    <!--todo width may not be enough-->
    <div class="banner"></div>
    <div id="main">
        <div class="left-wrapper">
            <div class="logo">
                <img src="images/eldercare.gif" alt="logo" width="240px" />
            </div>
<div class="menu-wrapper">
    <div id="cssmenu">
        <ul>
        <?php if ($userType == "System Admin") echo "
            <li class='has-sub'><a href='AttendanceHome.php'><span>Attendance</span></a>
                <ul>
                    <li><a href='AttendanceHome.php'><span>Attendance Taking</span></a></li>
                    <li><a href='ViewAttendanceRecord.php'><span>View Attendance</span></a></li>
                    <li><a href='BackDate.php'><span>BackDate</span></a></li>
                    <li class='last'><a href='VerifyAttendance.php'><span>Verify Attendance</span></a></li>
                </ul>
            </li>
            <li class='has-sub'><a href='#'><span>Profile</span></a>
                <ul>
                    <li><a href='Client.php'><span>Existing Client</span></a></li>
                    <li><a href='WClient.php'><span>Withdrawn Client</span></a></li>
                    <li><a href='User.php'><span>User</span></a></li>
                    <li class='last'><a href='Centres.php'><span>Centres</span></a></li>
                </ul>
            </li>
            <li class='has-sub'><a href='ActRecords.php'><span>Activities</span></a>
                <ul>
                    <li><a href='Activities.php'><span>Manage Current Activities</span></a></li>
                    <li><a href='ActRecords.php'><span>Activity Recording</span></a></li>
                    <li class='last'><a href='ViewActRecord.php'><span>View Activity Records</span></a></li>
                </ul>
            </li>
            <li><a href='Holidays.php'><span>Holiday</span></a></li>
            <li class='has-sub'><a href='#'><span>Reports</span></a>
                <ul>
                    <li><a href='Reports.php'><span>Attendance Reports</span></a></li>
                    <li><a href='ActReports.php'><span>Activity Reports</span></a></li>	                    
	                <li class='last'><a href='IndividualRpts.php'><span>Individual Reports</span></a></li>
                </ul>
            </li>
            <li><a href='ManagePassword.php'><span>Change Passwords</span></a></li>";?>
            <?php if ($userType == "Centre Manager") echo "
               <li class='has-sub'><a href='AttendanceHome.php'><span>Attendance</span></a>
                <ul>
                    <li><a href='AttendanceHome.php'><span>Attendance Taking</span></a></li>
                    <li><a href='ViewAttendanceRecord.php'><span>View Attendance</span></a></li>
                    <li><a href='BackDate.php'><span>BackDate</span></a></li>
                    <li class='last'><a href='VerifyAttendance.php'><span>Verify Attendance</span></a></li>
                </ul>
	            </li>
	            <li class='has-sub'><a href='#'><span>Profile</span></a>
	                <ul>
	                    <li><a href='Client.php'><span>Existing Client</span></a></li>
	                    <li><a href='WClient.php'><span>Withdrawn Client</span></a></li>
	                    <li class='last'><a href='User.php'><span>User</span></a></li>
	                </ul>
	            </li>
	            <li class='has-sub'><a href='ActRecords.php'><span>Activities</span></a>
	                <ul>
	                    <li><a href='ActRecords.php'><span>Activity Recording</span></a></li>
	                    <li class='last'><a href='ViewActRecord.php'><span>View Activity Records</span></a></li>
	                </ul>
	            </li>
	            <li class='has-sub'><a href='#'><span>Reports</span></a>
	                <ul>
	                    <li><a href='Reports.php'><span>Attendance Reports</span></a></li>
	                    <li><a href='ActReports.php'><span>Activity Reports</span></a></li>	                    
	                    <li class='last'><a href='IndividualRpts.php'><span>Individual Reports</span></a></li>
	                </ul>
	            </li>
	            <li><a href='ManagePassword.php'><span>Change Passwords</span></a></li>";?>
	            <?php if ($userType == "Therapy Assistant") echo "
	            <li class='has-sub'><a href='AttendanceHome.php'><span>Attendance</span></a>
                <ul>
                    <li><a href='AttendanceHome.php'><span>Attendance Taking</span></a></li>
                    <li class='last'><a href='ViewAttendanceRecord.php'><span>View Attendance</span></a></li>
                </ul>
	            </li>
	            <li class='has-sub'><a href='#'><span>Profile</span></a>
	                <ul>
	                    <li><a href='Client.php'><span>Existing Client</span></a></li>
	                    <li class='last'><a href='WClient.php'><span>Withdrawn Client</span></a></li>
	                </ul>
	            </li>
	            <li class='has-sub'><a href='ActRecords.php'><span>Activities</span></a>
	                <ul>
	                    <li><a href='Activities.php'><span>Manage Current Activities</span></a></li>
	                    <li><a href='ActRecords.php'><span>Activity Recording</span></a></li>
	                    <li class='last'><a href='ViewActRecord.php'><span>View Activity Records</span></a></li>
	                </ul>
	            </li>
	            <li class='has-sub'><a href='#'><span>Reports</span></a>
	                <ul>
	                    <li><a href='Reports.php'><span>Attendance Reports</span></a></li>
	                    <li><a href='ActReports.php'><span>Activity Reports</span></a></li>	                    
	                    <li class='last'><a href='IndividualRpts.php'><span>Individual Reports</span></a></li>
	                </ul>
	            </li>
	            <li><a href='ManagePassword.php'><span>Change Passwords</span></a></li>>";?>
        </ul>
    </div>
</div>
</div>

<div class="content">
            <div id="logout">
                
                <b style="float:right; margin: 0px 0 0 0">  
                		<?php
                        //session_start();
                        /* if (!empty($_SESSION["centreName"])) {
                            $Username = $_SESSION["username"];
                            $centreName = $_SESSION["centreName"];
                            echo "Welcome, " . $Username . " ! " . $centreName . " Branch";
                        } else {
                            $Username = $_SESSION["username"];
                            echo "Welcome, " . $Username;
                        } */
						?>
                        <?php
//session_start();
// set timeout period in seconds
                        /*$inactive = 7200;
// check to see if $_SESSION['timeout'] is set
                        if (isset($_SESSION["timeout"])) {
                            $session_life = time() - $_SESSION["timeout"];
                            if ($session_life > $inactive) {
                                session_destroy();
                                Header("Location: Timeout.php");
                            }
                        }
                        $_SESSION["timeout"] = time();*/
                        ?>
                <input type="submit" class="btn btn-danger" value="Logout" onclick="parent.location = 'logout.php'">
                </b>
            </div>

			<div class="content2">
                    <h1>Activities</h1>
                    <br>
                    <table id="dg" title="Activities" class="easyui-datagrid" style="width:958px;height:350px; "
                           url="CRUDAct/get_act.php"
                           toolbar="#toolbar" pagination="true"
                           rownumbers="true" fitColumns="true" singleSelect="true">
                        <thead>
                            <tr>
                                <th field="ActivityName" width="50">Activity Name</th>
                                <th field="Category" width="50">Category</th>
                                <th field="CentreName" width="50">Centre Name</th>

                        <tbody style="display:none">
                        <th field="ActivityId" width ="50">Activity Id</th>
                        </tr>
                        </thead>
                    </table>
                    <div id="toolbar">
                        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newAct();">New Activity</a>
                        <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editAct();">Edit Activity</a>
                        <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeAct();">Remove Activity</a>
                        <input id="searchid" name="searchid" type="text" style="border-radius:25px">  
                        <a href="#" class="easyui-linkbutton" iconCls="icon-search" onClick="getActivity();">Search</a>
                        <a href="#" class="easyui-linkbutton" onClick="findAll();">All</a>
                    </div>

                    <!-- Insert Dialog and Form -->
                    <div>
                        <div id="insertdlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
                             closed="true" buttons="#insertdlg-buttons">
                            <div class="ftitle">Activity Information</div>
                            <p></p>
                            <form id="insertform" method="post" novalidate>

                                <div class="fitem">
                                    <label>Activity Name: </label>
                                    <input name="ActivityName" class="easyui-validatebox" required="true"style="width:155px" height='auto'>
                                </div>
                                <p></p>
                                <div class="fitem">
                                    <label>Category: </label>
                                    <select name="Category"required ="true" class="easyui-combobox"style="width:155" height='auto'>
                                        <option value="Mental">Mental</option>        
                                        <option value="Physical">Physical</option>
										<option value="Social">Social</option>
                                     </select>
                                </div>
                                <p></p>
                                <div class="fitem">
                                    <label>Centre Name: </label>
                                    <select name="CentreName"required ="true" class="easyui-combobox"style="width:155" height='auto'>
                                        <option value="Tampines">Tampines</option>        
                                        <option value="Pasir Ris">Pasir Ris</option>
                                        <option value="Silver Circle (Marsiling)">Silver Circle (Marsiling)</option>
                                    </select>
                                </div>
                            </form>
                        </div>
                        <div id="insertdlg-buttons">
                            <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveAct();">Save</a>
                            <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#insertdlg').dialog('close');">Cancel</a>
                        </div>
                    </div>

                    <!-- Update Dialog and Form -->
                    <div>
                        <div id="updatedlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
                             closed="true" buttons="#updatedlg-buttons">
                            <div class="ftitle">Activity Information</div>
                            <p></p>
                            <form id="updateform" method="post" novalidate>
                                <div class="fitem">
                                    <input name="ActivityId" type="hidden" class="easyui-validatebox">
                                </div> <div class="fitem">
                                    <label>Activity Name: </label>
                                    <input name="ActivityName" class="easyui-validatebox" required="true"style="width:155px" height='auto'>
                                </div>
                                <p></p>
                                 <div class="fitem">
                                    <label>Category: </label>
                                    <select name="Category"required ="true" class="easyui-combobox"style="width:155" height='auto'>
                                        <option value="Mental">Mental</option>        
                                        <option value="Physical">Physical</option>
                                                
                                                <option value="Social">Social</option>
                                            </select>
                                </div>
                                <p></p>
                                <div class="fitem">
                                    <label>Centre Name: </label>
                                    <select name="CentreName"required ="true" class="easyui-combobox"style="width:155" height='auto'>
                                        <option value="Tampines">Tampines</option>        
                                        <option value="Pasir Ris">Pasir Ris</option>
                                        <option value="Silver Circle (Marsiling)">Silver Circle (Marsiling)</option>
                                    </select>
                                </div>
                            </form>
                        </div>

                        <div id="updatedlg-buttons">
                            <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="updateAct();">Save</a>
                            <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#updatedlg').dialog('close');">Cancel</a>
                        </div>
                    </div>
                 
            	<div class="clear"></div>
            </div>
